using Headspring.Training.Core.Services;

namespace Headspring.Training.Core.Model.StateCommands
{
	public class AssignedToInProgressCommand : StateCommandBase
	{
		public AssignedToInProgressCommand(WorkOrder workOrder, Employee currentUser)
			: base(workOrder, currentUser)
		{
		}

		public override string TransitionVerbPresentTense
		{
			get { return "Begin"; }
		}

		public override string TransitionVerbPastTense
		{
			get { return "Begun"; }
		}

		public override WorkOrderStatus GetBeginStatus()
		{
			return WorkOrderStatus.Assigned;
		}

		protected override WorkOrderStatus GetEndStatus()
		{
			return WorkOrderStatus.InProgress;
		}

		protected override bool userCanExecute(Employee currentUser)
		{
			return currentUser == _workOrder.Assignee;
		}

		protected override void postExecute(IStateCommandVisitor commandVisitor)
		{
			commandVisitor.EditWorkOrder(_workOrder);
		}
	}
}